Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

Previous Next
Subject: Problem: java agent reading from hppts url with username and password
Feedback Type: Problem
Product Area: Domino Server
Technical Area: Application Development
Platform: Linux server
Release: 8.5.1
Reproducible: -Reproducibility-

Hi all,

I am trying to read the content from a secured url (https + username and password) with a java agent (the code is attached below). The agent will run on the server as a scheduled agent but for now I am running it manually from the designer client.

I have added the .cer file to the keyfile.kyr as suggested in this post: http://www-10.lotus.com/ldd/nd8forum.nsf/5f27803bba85d8e285256bf10054620d/702cf07838c391c285257403004c1551?OpenDocument

The problem is that I get the content of the loggin page. It is like the code does not successfully loggin to the server.

I would appreciate any help on this problem!

Thank you very much,

Raquel

--------------------------------------
This is the code:

import lotus.domino.*;
import java.net.*;
import java.io.*;
import javax.net.ssl.HttpsURLConnection;

public class JavaAgent extends AgentBase {

public void NotesMain() {

try {
System.setProperty("java.protocol.handler.pkgs","com.ibm.net.ssl.www2.protocol");
URL url = new URL("https://uat.unov.org/CarbonWeb/Export.mvc/GetMeetings?modifiedSince=3/4/2010");
HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();

//set username, password
String username = "123";
String password = "456";
String input = username + ":" + password;
String encoding = new sun.misc.BASE64Encoder().encode (input.getBytes());
connection.setRequestProperty("Authorization", "Basic " + encoding);

//set cookie
connection.setRequestProperty("Cookie", "LocationCode=Geneva");

connection.connect();

BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));

String inputLine;

//Loop through every line of the URL.
while ((inputLine = in.readLine()) != null) {
System.out.println(inputLine.toString());
}

in.close();
} catch(Exception e) {
e.printStackTrace();
}
}
}


Feedback number WEBB83ZKDU created by ~Lorraine Xantoochekobu on 03/29/2010

Status: Open
Comments:





Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS